<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<%String path = request.getContextPath() ;%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
<div>
<div id="pageInTab" class="pageInTab">
	<!-- 页签1-->
	<div tabid="tabA" lselected="true">
		<div class="searchArea">
			<!-- 搜索表单开始 -->
			<form id="searchBar">
			
			</form>
			<!-- 搜索表单结束 -->
		</div>
		<!-- 列表显示块 -->
		<div id="ligergrid1" class="sq-grid"></div>
	</div>
	
</div>
</div>
</div>
<script type="text/javascript">
	var pageInApp={
		flag:false //tab页验证关闭
	};//to下一级子窗口 接口
	var pageInTab=null;//页签
	var loadedTabs=[];//页签
	var grid = null;
	
	$(function () {
		$("#searchBar").ligerForm();//初始化表单
	    initGrid();//初始化列表
	    searchBtnEvent();//查询按钮事件
	    clearBtnEvent();//清空按钮事件
	});
	
	
	
	//查询参数
	function getSearchParams(){
		var form = new liger.get("searchBar");
		var data = form.getData();
		return data;
	}
	
	//初始化列表
	function initGrid(){
		$("#ligergrid1").ligerGrid({
			url:'<%=path%>/archive/arcBscInfo/searchList.do',
			method:'get',
			parms:getSearchParams(),
			columns:[
				{ display: '主键', name: 'id',type:'text', hide:true},
				{ display: '权证名称', name: 'warrantName',  align:'center', enabledSort:true,width:300,
						render:function (rowdata, rowindex, value){
							return "<span title="+rowdata.warrantName+">"+rowdata.warrantName+"</span>";
						}},
				{ display: '权证类别', name: 'warrantType', align:'center', enabledSort:true},
				{ display: '是否电子', name: 'isEle', align:'center', enabledSort:true,
					render:function (rowdata, rowindex, value){
							return (value == "yes")?"是":"否";
					}
				},
				{ display: '状态', name: 'isValid', align:'center', enabledSort:true,
					render:function (rowdata, rowindex, value){
							return (value == "1")?"启用":"废弃";
					}
				},
				{ display: '归类级别', name: 'arcLevel', align:'center', enabledSort:true}
				
			],
			usePager:false,
			pageSize:1000,
			root:'rows',
			record:'total',
			hideLoadButton:false,
			width:'100%',
			height:'100%',
			heightDiff:-2,
			checkbox:true,//列表是否有选择框
			rownumbers:true,//列表是否有行号
		/* 	//选择行事件
			onSelectRow: function(rowdata, rowid, rowobj){
				
			},
			//取消选择行事件
			onUnSelectRow : function(rowdata, rowid, rowobj){
				
			} */
		});
		grid = liger.get("ligergrid1");
		grid.setHeight(100);
		//grid.options.isSingleCheck = false;//列表是否为单选
	}
	
	//发起申请
	function warrantFileManageApply(paySchId,paySchNo,prjPrdDtlId,prjId,businessType,prjTypCd,prjNm,orgName,cstId,cstNm){
		//回调刷新列表
		var param = '<%=path%>/warrant/warrantfilemanage/toApplyPage.do?paySchId=' + paySchId + '&&paySchNo=' + paySchNo +'&&prjPrdDtlId='+prjPrdDtlId+'&&prjId='+prjId+'&&businessType='+businessType;
		param += '&&prjTypCd='+prjTypCd+'&&prjNm='+prjNm+'&&orgName='+orgName+'&&cstId='+cstId+'&&cstNm='+cstNm;
		
		Add_navTab('warrantFileManage'+paySchId,'归档申请',param, function () {
			grid.reload();
		});
	}
	
	
	//清空按钮事件
	function clearBtnEvent(){
		$("#clearBtn").click(function(event) {
			$("#resetBtn").click();  //重置 input-text
			var form = liger.get("searchBar");
			form.setData({  //重置select等特殊表单
				"warrantType":"",
				"arcLevel":""
			});
		});
	}
	
	//查询按钮事件
	function searchBtnEvent(){
		$("#searchBtn").click(function(event) {
			var form = new liger.get("searchBar");
			var data = form.getData();
			//alert(JSON.stringify(data));
			for (name in data){
				grid.setParm(name,data[name]);
			};
			grid.reload();
		});
	}
	
	
	
	//档案基础信息新增和修改
	function save(id) {
		var title ="修改";
		if(id == "") {
			title ="新增";
		}
		Add_navTab("arcBscInfo"+id, "基础档案资料"+title, '<%=path%>/archive/arcBscInfo/toSave.do?id='+id , function () {
			grid.reload();
		});
	}
	
	
	
	//删除
	function removeById(id) {
		
		$.ligerDialog.confirm('确定删除吗?', function (flag) {
			if(flag == false)return;
			var wait_dialog;
			$.ajax({
				type: 'post',
				dataType:'json',
				url: '<%=path%>/archive/arcBscInfo/removeById.do?id='+id,
				beforeSend: function(){
			          wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
			     },
				success:function(msg){
					wait_dialog.close();
					 if(msg.success == 1){
						 $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
						 grid.reload();
					 }else{
						 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
					 }
				}
			});
		});
	}
	
	 frameElement.dialog.onOk = function () {
		 	var selectedRows = grid.getSelectedRows();
			if(selectedRows.length == 0){
				$.ligerDialog.SQalert({content: "请选择" , SQ_type: "warning" });
				return;
			}
			
			frameElement.dialog._DATA= selectedRows; //给父窗口的dialog传参
			frameElement.dialog.close(); 
	 }
	 
	
	
	
</script>
</body>
</html>